import { _decorator, Component, input, Node } from 'cc';
import { PlayerState } from './PlayerState';
import { StateDefine } from '../../Config';
const { ccclass, property } = _decorator;

@ccclass('PlayerAirState')
export class PlayerAirState extends PlayerState {
    onEnter() {
        super.onEnter();
    }
    onExit() {
        super.onExit()
    }
    update(deltaTime: number) {
        super.update(deltaTime);
        if (this.player.input.x != 0) {
            this.player.setVelocity(this.player.MoveSpeed * this.player.input.x * 0.8, this.rb.linearVelocity.y)
        }
        if (this.player.IsGroundDetected()) {
            this.player.stateMgr.transit(StateDefine.Idle);
        }
        if (this.player.IsWallDetected()) {
            this.player.stateMgr.transit(StateDefine.WallSilde);
        }
    }
    onDestory() { }

    canTransit(to: StateDefine): boolean {
        return true
    }
}


